import type { MainResponseType, buyListType } from "@/common/model/response";
import request from "@/utils/axios";

const URL = {
  getAnnounceDetail: "api/getAnnounceDetail", //资讯详情
  getAnnounceList: "api/getAnnounceList", //资讯列表
  getBannerList: "api/getBanner", //轮播图
};

export function getAnnounceDetail(announce_id: string) {
  return request.get<
    any,
    MainResponseType<{
      id: number;
      title: string;
      addtime: string;
      content: string;
    }>
  >(URL.getAnnounceDetail, {
    params: {
      announce_id,
    },
  });
}
export function getAnnounceList(page: string) {
  return request.get<
    any,
    MainResponseType<
      buyListType<
        { id: number; title: string; cover: string; addtime: string }[]
      >
    >
  >(URL.getAnnounceList, {
    params: {
      page,
    },
  });
}

export function getBannerList() {
  return request.get<any>(URL.getBannerList);
}
